package traverser;

// Implemented by Dong, I believe (-Dan)

import java.util.Scanner;
public class StrStr {
	public static void main(String[]args){
		Scanner r=new Scanner(System.in);
		String s1=r.nextLine();
		String s2=r.nextLine();
		
		if(strstr(s1, s2)){
			System.out.println("Yes");
		}else{
			System.out.println("NO");
		}
	}
	
	public static boolean strstr (String s1, String s2) {
		int i1 = s1.length();
		int i2 = s2.length();
		int temp;
		int cal = 0;
		boolean b = false;
		String temp1;
		if (i2 >= i1){
			temp = i1;
			i1 = i2;
			i2 = temp;
			temp1 = s1;
			s1 = s2;
			s2 = temp1;
		}
		
		int i;
		int j;
		for(i = 0; i <= i1 - i2; i++){
			if(s2.charAt(0) == s1.charAt(i)){
				cal = 0;
				for(j = 0; j <= i2 - 1; j++)
					if(s2.charAt(j)==s1.charAt(i+j))
						cal++;
				if(cal==i2)
					b=true;
			}

		}    

		return b;
	}
}

	
